const dic = {
  factoryList: [
    {
      label: '纸箱',
      value: '1'
    },
    {
      label: '纸袋',
      value: '2'
    },
    {
      label: '立方盒',
      value: '3'
    }
  ],
}
export const option = function () {
  return {
    border: true,
    stripe: true,
    addBtn: false,
    editBtn: false,
    viewBtn: false,
    printBtn: false,
    addRowBtn: false,
    align: 'center',
    selection: true,
    menu: false,
    tip: false,
    index: true,
    indexLabel: '序号',
    column: [
      {
        label: '物料分类编码',
        prop: 'classifyCode',
        cell: false
      },
      {
        label: '物料分类名称',
        prop: 'classifyCnName',
        cell: false
      },
      {
        label: '有效期起',
        prop: 'validityPeriodBegin',
        type: 'date',
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        cell: true,
        pickerOptions: {
          disabledDate: data => data.getTime() < new Date(this.column.validityPeriodEnd).getTime()
        },
        rules: [
          {
            required: true,
            message: '请选择有效期起'
          }
        ],
        control: (val, form) => {
          if (!val) {
            return {
              validityPeriodBegin: {
                value: '-'
              }
            }
          }
        }
      },
      {
        label: '有效期止',
        prop: 'validityPeriodEnd',
        type: 'date',
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        cell: true,
        pickerOptions: {
          disabledDate: data => data.getTime() < new Date(this.column.validityPeriodBegin).getTime()
        },
        rules: [
          {
            required: true,
            message: '请选择有效期止'
          }
        ],
        control: (val, form) => {
          if (!val) {
            return {
              validityPeriodEnd: {
                value: '-'
              }
            }
          }
        }
      },
      {
        label: '供应工厂',
        prop: 'supplierFactory',
        type: 'select',
        multiple: true,
        remote: true,
        dicData:dic.factoryList,
        cell: true
      }
    ]
  }
}
